// Copyright (c) 2019 Presto Labs Pte. Ltd.
// Author: linchuan

#include "coin2/exchange/bithumb/symbology/currency.h"

#include <gtest/gtest.h>

TEST(BithumbCurrency, constructor) {
  using namespace coin2::exchange::bithumb::symbology;
  using coin2::exchange::base::market::ExchangeType;
  using coin2::exchange::base::market::MarketType;

  int64_t resolve_ts = 1572502253 * 1e9;

  BithumbCurrency usdt("KRW");
  EXPECT_EQ(usdt.currency(), "KRW");
  EXPECT_EQ(usdt.native_currency(MarketType::Spot), "KRW");
  EXPECT_EQ(usdt.rep_currency(), "KRW");
  EXPECT_EQ(usdt.exchange(), ExchangeType::Bithumb);

  auto btc1 = BithumbCurrency::FromNativeStr("BTC", resolve_ts);
  EXPECT_EQ(btc1.currency(), "BTC");
  EXPECT_EQ(btc1.native_currency(MarketType::Spot), "BTC");
  EXPECT_EQ(btc1.native_currency(MarketType::Futures), "BTC");
  EXPECT_EQ(btc1.exchange(), ExchangeType::Bithumb);

  auto btc2 = BithumbCurrency::FromNativeStr("BTC", resolve_ts);
  auto btc3 = BithumbCurrency::FromNormStr("BTC", resolve_ts);
  auto btc4 = BithumbCurrency::FromStr("BTC", resolve_ts);
  EXPECT_EQ(btc2, btc1);
  EXPECT_EQ(btc3, btc1);
  EXPECT_EQ(btc4, btc1);

  auto btc = BithumbCurrency::FromStr("btc", resolve_ts);
  EXPECT_EQ(btc.currency(), "BTC");
  EXPECT_EQ(btc.native_currency(MarketType::Spot), "BTC");

  auto bsv = BithumbCurrency::FromStr("bsv", resolve_ts);
  EXPECT_EQ(bsv.currency(), "BCHSV");
  EXPECT_EQ(bsv.native_currency(MarketType::Spot), "BSV");

  auto bch = BithumbCurrency::FromStr("BCH", resolve_ts);
  EXPECT_EQ(bch.currency(), "BCHABC");
  EXPECT_EQ(bch.native_currency(MarketType::Spot), "BCH");
}
